/*
 * hmm_partial.h
 *
 *  Created on: Jul 13, 2011
 *      Author: tqlong
 */

#ifndef HMM_PARTIAL_H_
#define HMM_PARTIAL_H_

/** HMM works with partially known state sequence
 */

#include "hmm.h"

class PartialHMM : public HiddenMarkovModel
{
public:
  typedef std::vector<int> seq_type;
  typedef std::vector<seq_type> vseq_type;

public:
  PartialHMM(int n_state, int n_observation);

  /** Maximum a priori state sequence (viterbi algorithm)
   *  with partially known state sequence (p_sseq).
   *  Unknown states are marked by -1
   */
  void
  map(const seq_type &oseq, const seq_type &p_sseq, seq_type &sseq);

protected:
  void
  viterbi_forward_pass();

  void
  viterbi_backward_pass();

protected:
  /** The partially known state sequence */
  seq_type p_sseq_;
};

typedef PartialHMM phmm;

#endif /* HMM_PARTIAL_H_ */
